<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>APP</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <style>
        .aui-bar-info{
            background: #fff;
            color:#000;
        }
        .aui-icon-more{
            color:#000 !important;
        }
    </style>
</head>
<body>
        <header class="aui-bar aui-bar-nav aui-border-b">
            <div class="aui-pull-left aui-iconfont aui-icon-left icon-left-coler" tapmode onclick="closeWin()"></div>
            <div class="aui-title">
                Aileen纱纺有限公司
            </div>
             <i class="aui-iconfont aui-icon-more  aui-pull-right" tapmode onclick="popHome()"></i>
        </header>
</body>
<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript" src="../script/jquery-1.11.3.js"></script>
<script type="text/javascript" src="../script/mui.js"></script>
<script type="text/javascript">
    

    apiready = function(){
        $api.text($api.byId('nickname'),api.pageParam.targetNickname);
            var header = $api.dom('header');
        var headerPos = $api.offset(header);
        var body_h = $api.offset($api.dom('body')).h;
        api.openFrame({
            name: 'chat_frm',
            url: 'chat_frm.html',
            bounces: true,
            rect: {
                x: 0,
                y: headerPos.h,
                w: 'auto',
                h: api.winHeight-headerPos.h-45
            },
            pageParam:{
                targetId:api.pageParam.targetId,
                targetAvatar:api.pageParam.targetAvatar,
                targetNickname:api.pageParam.targetNickname
            }
        });
        api.addEventListener({
            name:'keyback'
        },function(ret,err){
            closeWin();
        });
    };
    function closeWin(){
        api.sendEvent({
            name:'closeChat'
        })
        api.closeWin();
    }

    // mui遮罩
    var mask;
    // 显示遮罩
    function popHome(){
        mask = mui.createMask(hidePicker);
        mask.show();
        //跨域执行子frame的显示mask
        api.execScript({
            frameName:"chat_frm",
            script:"showMask()"
        })
    }
    // 关闭遮罩
    function hidePicker(){
        //跨域执行子frame的关闭mask
        api.execScript({
            frameName:"chat_frm",
            script:"hideFrmMask()"
        })
    }
    //接收子frm执行的关闭遮罩
    function closeWinMask(){
        mask.myclose();
        //hidePicker();
    }
</script>
</html>